package com.dkm.ec.home.persistence.entity;


/**
 * 对象功能:skg_home_answer entity对象
 * 开发公司:SKG.COM
 * 开发人员:喻永淼
 * 创建时间:2015-01-07 10:39:31
 */
public class HomeAnswerPo extends HomeAnswerTbl{
	private String answer;
	private String formatAnswer="";
	private String designerName;
	
	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
		
	}

	public String getFormatAnswer() {
		return formatAnswer;
	}
	
	private String format(String answerStr){
		String[]strs= answerStr.split("<p>");
		for(String tempStr:strs){
			if(tempStr.indexOf("<img")==-1){
			formatAnswer+=tempStr;
			}
		}
		
		String[]strs1= formatAnswer.split("</p>");
		formatAnswer="";
		for(String tempStr:strs1){
			formatAnswer+=tempStr;
		}
		
		String[]strs2= formatAnswer.split("<br />");
		formatAnswer="";
		for(String tempStr:strs2){
			formatAnswer+=tempStr;
		}
		
		String[]strs3= formatAnswer.split("<br/>");
		formatAnswer="";
		for(String tempStr:strs3){
			formatAnswer+=tempStr;
		}
		
		String[]strs4= formatAnswer.split("</div>");
		formatAnswer="";
		for(String tempStr:strs4){
			formatAnswer+=tempStr;
		}
		 
		String[]strs5= formatAnswer.split("<a href="+null+"></a>");
		formatAnswer="";
		for(String tempStr:strs5){
			formatAnswer+=tempStr;
		}
		
		System.out.println(formatAnswer);
		return formatAnswer;
	}


	public void setFormatAnswer(String formatAnswer) {
		if(formatAnswer!=null&&!formatAnswer.equals("")){
			String temp=format(formatAnswer);		
			this.formatAnswer = temp;
		}else {
			this.formatAnswer = formatAnswer;
		}
		
	}

	public String getDesignerName() {
		return designerName;
	}

	public void setDesignerName(String designerName) {
		this.designerName = designerName;
	}
	
	
	public static void main(String[] args) {
	 String string="<p>你</p><p>好</p><p><img sadfsad></img></p><p><img  asdsad></img></p>";
	 new HomeAnswerPo().format(string);
	}
	
	
	
}